home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / Fresco / build / Unix / config / makedepend / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-12  |  15.0 KB  |  714 lines

  1. /* $XConsortium: main.c,v 1.84.1 94/11/30 16:10:44 kaleb Exp $ */
  2. /*
  3.  
  4. Copyright (c) 1993, 1994  X Consortium
  5.  
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of the X Consortium shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from the X Consortium.
  26.  
  27. */
  28.  
  29. #include "def.h"
  30. #ifdef hpux
  31. #define sigvec sigvector
  32. #endif /* hpux */
  33.  
  34. #ifdef X_POSIX_C_SOURCE
  35. #define _POSIX_C_SOURCE X_POSIX_C_SOURCE
  36. #include <signal.h>
  37. #undef _POSIX_C_SOURCE
  38. #else
  39. #if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE)
  40. #include <signal.h>
  41. #else
  42. #define _POSIX_SOURCE
  43. #include <signal.h>
  44. #undef _POSIX_SOURCE
  45. #endif
  46. #endif
  47.  
  48. #if NeedVarargsPrototypes
  49. #include <stdarg.h>
  50. #endif
  51.  
  52. #ifdef DEBUG
  53. int    _debugmask;
  54. #endif
  55.  
  56. char *ProgramName;
  57.  
  58. char    *directives[] = {
  59.     "if",
  60.     "ifdef",
  61.     "ifndef",
  62.     "else",
  63.     "endif",
  64.     "define",
  65.     "undef",
  66.     "include",
  67.     "line",
  68.     "pragma",
  69.     "error",
  70.     "ident",
  71.     "sccs",
  72.     "elif",
  73.     "eject",
  74.     NULL
  75. };
  76.  
  77. #define MAKEDEPEND
  78. #include "imakemdep.h"    /* from config sources */
  79. #undef MAKEDEPEND
  80.  
  81. struct    inclist inclist[ MAXFILES ],
  82.         *inclistp = inclist,
  83.         maininclist;
  84.  
  85. char    *filelist[ MAXFILES ];
  86. char    *includedirs[ MAXDIRS + 1 ];
  87. char    *notdotdot[ MAXDIRS ];
  88. char    *objprefix = "";
  89. char    *objsuffix = OBJSUFFIX;
  90. char    *startat = "# DO NOT DELETE";
  91. int    width = 78;
  92. boolean    append = FALSE;
  93. boolean    printed = FALSE;
  94. boolean    verbose = FALSE;
  95. boolean    show_where_not = FALSE;
  96. boolean warn_multiple = FALSE;    /* Warn on multiple includes of same file */
  97. boolean objects_are_basenames = FALSE; /* Chop off filenames' directories */
  98.  
  99. static
  100. #ifdef SIGNALRETURNSINT
  101. int
  102. #else
  103. void
  104. #endif
  105. catch (sig)
  106.     int sig;
  107. {
  108.     fflush (stdout);
  109.     fatalerr ("got signal %d\n", sig);
  110. }
  111.  
  112. #if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32)
  113. #define USGISH
  114. #endif
  115.  
  116. #ifndef USGISH
  117. #ifndef _POSIX_SOURCE
  118. #define sigaction sigvec
  119. #define sa_handler sv_handler
  120. #define sa_mask sv_mask
  121. #define sa_flags sv_flags
  122. #endif
  123. struct sigaction sig_act;
  124. #endif /* USGISH */
  125.  
  126. main(argc, argv)
  127.     int    argc;
  128.     char    **argv;
  129. {
  130.     register char    **fp = filelist;
  131.     register char    **incp = includedirs;
  132.     register char    *p;
  133.     register struct inclist    *ip;
  134.     char    *makefile = NULL;
  135.     struct filepointer    *filecontent;
  136.     struct symtab *psymp = predefs;
  137.     char *endmarker = NULL;
  138.     char *defincdir = NULL;
  139.  
  140.     ProgramName = argv[0];
  141.  
  142.     while (psymp->s_name)
  143.     {
  144.         define2(psymp->s_name, psymp->s_value, &maininclist);
  145.         psymp++;
  146.     }
  147.     if (argc == 2 && argv[1][0] == '@') {
  148.         struct stat ast;
  149.         int afd;
  150.         char *args;
  151.         char **nargv;
  152.         int nargc;
  153.         char quotechar = '\0';
  154.  
  155.         nargc = 1;
  156.         if ((afd = open(argv[1]+1, O_RDONLY)) < 0)
  157.         fatalerr("cannot open \"%s\"\n", argv[1]+1);
  158.         fstat(afd, &ast);
  159.         args = (char *)malloc(ast.st_size + 1);
  160.         if ((ast.st_size = read(afd, args, ast.st_size)) < 0)
  161.         fatalerr("failed to read %s\n", argv[1]+1);
  162.         args[ast.st_size] = '\0';
  163.         close(afd);
  164.         for (p = args; *p; p++) {
  165.         if (quotechar) {
  166.             if (quotechar == '\\' ||
  167.             (*p == quotechar && p[-1] != '\\'))
  168.             quotechar = '\0';
  169.             continue;
  170.         }
  171.         switch (*p) {
  172.         case '\\':
  173.         case '"':
  174.         case '\'':
  175.             quotechar = *p;
  176.             break;
  177.         case ' ':
  178.         case '\n':
  179.             *p = '\0';
  180.             if (p > args && p[-1])
  181.             nargc++;
  182.             break;
  183.         }
  184.         }
  185.         if (p[-1])
  186.         nargc++;
  187.         nargv = (char **)malloc(nargc * sizeof(char *));
  188.         nargv[0] = argv[0];
  189.         argc = 1;
  190.         for (p = args; argc < nargc; p += strlen(p) + 1)
  191.         if (*p) nargv[argc++] = p;
  192.         argv = nargv;
  193.     }
  194.     for(argc--, argv++; argc; argc--, argv++) {
  195.             /* if looking for endmarker then check before parsing */
  196.         if (endmarker && strcmp (endmarker, *argv) == 0) {
  197.             endmarker = NULL;
  198.             continue;
  199.         }
  200.         if (**argv != '-') {
  201.             /* treat +thing as an option for C++ */
  202.             if (endmarker && **argv == '+')
  203.                 continue;
  204.             *fp++ = argv[0];
  205.             continue;
  206.         }
  207.         switch(argv[0][1]) {
  208.         case '-':
  209.             endmarker = &argv[0][2];
  210.             if (endmarker[0] == '\0') endmarker = "--";
  211.             break;
  212.         case 'D':
  213.             if (argv[0][2] == '\0') {
  214.                 argv++;
  215.                 argc--;
  216.             }
  217.             for (p=argv[0] + 2; *p ; p++)
  218.                 if (*p == '=') {
  219.                     *p = ' ';
  220.                     break;
  221.                 }
  222.             define(argv[0] + 2, &maininclist);
  223.             break;
  224.         case 'I':
  225.             if (incp >= includedirs + MAXDIRS)
  226.                 fatalerr("Too many -I flags.\n");
  227.             *incp++ = argv[0]+2;
  228.             if (**(incp-1) == '\0') {
  229.                 *(incp-1) = *(++argv);
  230.                 argc--;
  231.             }
  232.             break;
  233.         case 'Y':
  234.             defincdir = argv[0]+2;
  235.             break;
  236.         /* do not use if endmarker processing */
  237.         case 'a':
  238.             if (endmarker) break;
  239.             append = TRUE;
  240.             break;
  241.         case 'w':
  242.             if (endmarker) break;
  243.             if (argv[0][2] == '\0') {
  244.                 argv++;
  245.                 argc--;
  246.                 width = atoi(argv[0]);
  247.             } else
  248.                 width = atoi(argv[0]+2);
  249.             break;
  250.         case 'o':
  251.             if (endmarker) break;
  252.             if (argv[0][2] == '\0') {
  253.                 argv++;
  254.                 argc--;
  255.                 objsuffix = argv[0];
  256.             } else
  257.                 objsuffix = argv[0]+2;
  258.             break;
  259.         case 'p':
  260.             if (endmarker) break;
  261.             if (argv[0][2] == '\0') {
  262.                 argv++;
  263.                 argc--;
  264.                 objprefix = argv[0];
  265.             } else
  266.                 objprefix = argv[0]+2;
  267.             break;
  268.         case 'v':
  269.             if (endmarker) break;
  270.             verbose = TRUE;
  271. #ifdef DEBUG
  272.             if (argv[0][2])
  273.                 _debugmask = atoi(argv[0]+2);
  274. #endif
  275.             break;
  276.         case 's':
  277.             if (endmarker) break;
  278.             startat = argv[0]+2;
  279.             if (*startat == '\0') {
  280.                 startat = *(++argv);
  281.                 argc--;
  282.             }
  283.             if (*startat != '#')
  284.                 fatalerr("-s flag's value should start %s\n",
  285.                     "with '#'.");
  286.             break;
  287.         case 'f':
  288.             if (endmarker) break;
  289.             makefile = argv[0]+2;
  290.             if (*makefile == '\0') {
  291.                 makefile = *(++argv);
  292.                 argc--;
  293.             }
  294.             break;
  295.         case 'm':
  296.             warn_multiple = TRUE;
  297.             break;
  298.         case 'b':
  299.             objects_are_basenames = TRUE;
  300.             break;
  301.             
  302.         /* Ignore -O, -g so we can just pass ${CFLAGS} to
  303.            makedepend
  304.          */
  305.         case 'O':
  306.         case 'g':
  307.             break;
  308.         default:
  309.             if (endmarker) break;
  310.     /*        fatalerr("unknown opt = %s\n", argv[0]); */
  311.             warning("ignoring option %s\n", argv[0]);
  312.         }
  313.     }
  314.     if (!defincdir) {
  315. #ifdef PREINCDIR
  316.         if (incp >= includedirs + MAXDIRS)
  317.         fatalerr("Too many -I flags.\n");
  318.         *incp++ = PREINCDIR;
  319. #endif
  320.         if (incp >= includedirs + MAXDIRS)
  321.         fatalerr("Too many -I flags.\n");
  322.         *incp++ = INCLUDEDIR;
  323. #ifdef POSTINCDIR
  324.         if (incp >= includedirs + MAXDIRS)
  325.         fatalerr("Too many -I flags.\n");
  326.         *incp++ = POSTINCDIR;
  327. #endif
  328.     } else if (*defincdir) {
  329.         if (incp >= includedirs + MAXDIRS)
  330.         fatalerr("Too many -I flags.\n");
  331.         *incp++ = defincdir;
  332.     }
  333.  
  334.     redirect(startat, makefile);
  335.  
  336.     /*
  337.      * catch signals.
  338.      */
  339. #ifdef USGISH
  340. /*  should really reset SIGINT to SIG_IGN if it was.  */
  341. #ifdef SIGHUP
  342.     signal (SIGHUP, catch);
  343. #endif
  344.     signal (SIGINT, catch);
  345. #ifdef SIGQUIT
  346.     signal (SIGQUIT, catch);
  347. #endif
  348.     signal (SIGILL, catch);
  349. #ifdef SIGBUS
  350.     signal (SIGBUS, catch);
  351. #endif
  352.     signal (SIGSEGV, catch);
  353. #ifdef SIGSYS
  354.     signal (SIGSYS, catch);
  355. #endif
  356. #else
  357.     sig_act.sa_handler = catch;
  358. #ifdef _POSIX_SOURCE
  359.     sigemptyset(&sig_act.sa_mask);
  360.     sigaddset(&sig_act.sa_mask, SIGINT);
  361.     sigaddset(&sig_act.sa_mask, SIGQUIT);
  362. #ifdef SIGBUS
  363.     sigaddset(&sig_act.sa_mask, SIGBUS);
  364. #endif
  365.     sigaddset(&sig_act.sa_mask, SIGILL);
  366.     sigaddset(&sig_act.sa_mask, SIGSEGV);
  367.     sigaddset(&sig_act.sa_mask, SIGHUP);
  368.     sigaddset(&sig_act.sa_mask, SIGPIPE);
  369. #ifdef SIGSYS
  370.     sigaddset(&sig_act.sa_mask, SIGSYS);
  371. #endif
  372. #else
  373.     sig_act.sa_mask = ((1<<(SIGINT -1))
  374.                |(1<<(SIGQUIT-1))
  375. #ifdef SIGBUS
  376.                |(1<<(SIGBUS-1))
  377. #endif
  378.                |(1<<(SIGILL-1))
  379.                |(1<<(SIGSEGV-1))
  380.                |(1<<(SIGHUP-1))
  381.                |(1<<(SIGPIPE-1))
  382. #ifdef SIGSYS
  383.                |(1<<(SIGSYS-1))
  384. #endif
  385.                );
  386. #endif /* _POSIX_SOURCE */
  387.     sig_act.sa_flags = 0;
  388.     sigaction(SIGHUP, &sig_act, (struct sigaction *)0);
  389.     sigaction(SIGINT, &sig_act, (struct sigaction *)0);
  390.     sigaction(SIGQUIT, &sig_act, (struct sigaction *)0);
  391.     sigaction(SIGILL, &sig_act, (struct sigaction *)0);
  392. #ifdef SIGBUS
  393.     sigaction(SIGBUS, &sig_act, (struct sigaction *)0);
  394. #endif
  395.     sigaction(SIGSEGV, &sig_act, (struct sigaction *)0);
  396. #ifdef SIGSYS
  397.     sigaction(SIGSYS, &sig_act, (struct sigaction *)0);
  398. #endif
  399. #endif /* USGISH */
  400.  
  401.     /*
  402.      * now peruse through the list of files.
  403.      */
  404.     for(fp=filelist; *fp; fp++) {
  405.         filecontent = getfile(*fp);
  406.         ip = newinclude(*fp, (char *)NULL);
  407.  
  408.         find_includes(filecontent, ip, ip, 0, FALSE);
  409.         freefile(filecontent);
  410.         recursive_pr_include(ip, ip->i_file, base_name(*fp));
  411.         inc_clean();
  412.     }
  413.     if (printed)
  414.         printf("\n");
  415.     exit(0);
  416. }
  417.  
  418. struct filepointer *getfile(file)
  419.     char    *file;
  420. {
  421.     register int    fd;
  422.     struct filepointer    *content;
  423.     struct stat    st;
  424.  
  425.     content = (struct filepointer *)malloc(sizeof(struct filepointer));
  426.     if ((fd = open(file, O_RDONLY)) < 0) {
  427.         warning("cannot open \"%s\"\n", file);
  428.         content->f_p = content->f_base = content->f_end = (char *)malloc(1);
  429.         *content->f_p = '\0';
  430.         return(content);
  431.     }
  432.     fstat(fd, &st);
  433.     content->f_base = (char *)malloc(st.st_size+1);
  434.     if (content->f_base == NULL)
  435.         fatalerr("cannot allocate mem\n");
  436.     if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0)
  437.         fatalerr("failed to read %s\n", file);
  438.     close(fd);
  439.     content->f_len = st.st_size+1;
  440.     content->f_p = content->f_base;
  441.     content->f_end = content->f_base + st.st_size;
  442.     *content->f_end = '\0';
  443.     content->f_line = 0;
  444.     return(content);
  445. }
  446.  
  447. freefile(fp)
  448.     struct filepointer    *fp;
  449. {
  450.     free(fp->f_base);
  451.     free(fp);
  452. }
  453.  
  454. char *copy(str)
  455.     register char    *str;
  456. {
  457.     register char    *p = (char *)malloc(strlen(str) + 1);
  458.  
  459.     strcpy(p, str);
  460.     return(p);
  461. }
  462.  
  463. match(str, list)
  464.     register char    *str, **list;
  465. {
  466.     register int    i;
  467.  
  468.     for (i=0; *list; i++, list++)
  469.         if (strcmp(str, *list) == 0)
  470.             return(i);
  471.     return(-1);
  472. }
  473.  
  474. /*
  475.  * Get the next line.  We only return lines beginning with '#' since that
  476.  * is all this program is ever interested in.
  477.  */
  478. char *getline(filep)
  479.     register struct filepointer    *filep;
  480. {
  481.     register char    *p,    /* walking pointer */
  482.             *eof,    /* end of file pointer */
  483.             *bol;    /* beginning of line pointer */
  484.     register    lineno;    /* line number */
  485.  
  486.     p = filep->f_p;
  487.     eof = filep->f_end;
  488.     if (p >= eof)
  489.         return((char *)NULL);
  490.     lineno = filep->f_line;
  491.  
  492.     for(bol = p--; ++p < eof; ) {
  493.         if (*p == '/' && *(p+1) == '*') { /* consume comments */
  494.             *p++ = ' ', *p++ = ' ';
  495.             while (*p) {
  496.                 if (*p == '*' && *(p+1) == '/') {
  497.                     *p++ = ' ', *p = ' ';
  498.                     break;
  499.                 }
  500.                 else if (*p == '\n')
  501.                     lineno++;
  502.                 *p++ = ' ';
  503.             }
  504.             continue;
  505.         }
  506. #ifdef WIN32
  507.         else if (*p == '/' && *(p+1) == '/') { /* consume comments */
  508.             *p++ = ' ', *p++ = ' ';
  509.             while (*p && *p != '\n')
  510.                 *p++ = ' ';
  511.             lineno++;
  512.             continue;
  513.         }
  514. #endif
  515.         else if (*p == '\\') {
  516.             if (*(p+1) == '\n') {
  517.                 *p = ' ';
  518.                 *(p+1) = ' ';
  519.                 lineno++;
  520.             }
  521.         }
  522.         else if (*p == '\n') {
  523.             lineno++;
  524.             if (*bol == '#') {
  525.                 register char *cp;
  526.  
  527.                 *p++ = '\0';
  528.                 /* punt lines with just # (yacc generated) */
  529.                 for (cp = bol+1; 
  530.                      *cp && (*cp == ' ' || *cp == '\t'); cp++);
  531.                 if (*cp) goto done;
  532.             }
  533.             bol = p+1;
  534.         }
  535.     }
  536.     if (*bol != '#')
  537.         bol = NULL;
  538. done:
  539.     filep->f_p = p;
  540.     filep->f_line = lineno;
  541.     return(bol);
  542. }
  543.  
  544. /*
  545.  * Strip the file name down to what we want to see in the Makefile.
  546.  * It will have objprefix and objsuffix around it.
  547.  */
  548. char *base_name(file)
  549.     register char    *file;
  550. {
  551.     register char    *p;
  552.  
  553.     if (objects_are_basenames) {
  554.         for (p=file+strlen(file); p>file && *p != '/'; p--) ;
  555.  
  556.         if (*p == '/')
  557.             p++;
  558.  
  559.         file = copy(p);
  560.     } else {
  561.         file = copy(file);
  562.     }    
  563.  
  564.     for(p=file+strlen(file); p>file && *p != '.'; p--) ;
  565.  
  566.     if (*p == '.')
  567.         *p = '\0';
  568.     return(file);
  569. }
  570.  
  571. #if defined(USG) && !defined(CRAY) && !defined(SVR4)
  572. int rename (from, to)
  573.     char *from, *to;
  574. {
  575.     (void) unlink (to);
  576.     if (link (from, to) == 0) {
  577.     unlink (from);
  578.     return 0;
  579.     } else {
  580.     return -1;
  581.     }
  582. }
  583. #endif /* USGISH */
  584.  
  585. redirect(line, makefile)
  586.     char    *line,
  587.         *makefile;
  588. {
  589.     struct stat    st;
  590.     FILE    *fdin, *fdout;
  591.     char    backup[ BUFSIZ ],
  592.         buf[ BUFSIZ ];
  593.     boolean    found = FALSE;
  594.     int    len;
  595.  
  596.     /*
  597.      * if makefile is "-" then let it pour onto stdout.
  598.      */
  599.     if (makefile && *makefile == '-' && *(makefile+1) == '\0')
  600.         return;
  601.  
  602.     /*
  603.      * use a default makefile is not specified.
  604.      */
  605.     if (!makefile) {
  606.         if (stat("Makefile", &st) == 0)
  607.             makefile = "Makefile";
  608.         else if (stat("makefile", &st) == 0)
  609.             makefile = "makefile";
  610.         else
  611.             fatalerr("[mM]akefile is not present\n");
  612.     }
  613.     else
  614.         stat(makefile, &st);
  615.     if ((fdin = fopen(makefile, "r")) == NULL)
  616.         fatalerr("cannot open \"%s\"\n", makefile);
  617.     sprintf(backup, "%s.bak", makefile);
  618.     unlink(backup);
  619. #ifdef WIN32
  620.     fclose(fdin);
  621. #endif
  622.     if (rename(makefile, backup) < 0)
  623.         fatalerr("cannot rename %s to %s\n", makefile, backup);
  624. #ifdef WIN32
  625.     if ((fdin = fopen(backup, "r")) == NULL)
  626.         fatalerr("cannot open \"%s\"\n", backup);
  627. #endif
  628.     if ((fdout = freopen(makefile, "w", stdout)) == NULL)
  629.         fatalerr("cannot open \"%s\"\n", backup);
  630.     len = strlen(line);
  631.     while (!found && fgets(buf, BUFSIZ, fdin)) {
  632.         if (*buf == '#' && strncmp(line, buf, len) == 0)
  633.             found = TRUE;
  634.         fputs(buf, fdout);
  635.     }
  636.     if (!found) {
  637.         if (verbose)
  638.         warning("Adding new delimiting line \"%s\" and dependencies...\n",
  639.             line);
  640.         puts(line); /* same as fputs(fdout); but with newline */
  641.     } else if (append) {
  642.         while (fgets(buf, BUFSIZ, fdin)) {
  643.         fputs(buf, fdout);
  644.         }
  645.     }
  646.     fflush(fdout);
  647. #if defined(USGISH) || defined(_SEQUENT_)
  648.     chmod(makefile, st.st_mode);
  649. #else
  650.         fchmod(fileno(fdout), st.st_mode);
  651. #endif /* USGISH */
  652. }
  653.  
  654. #if NeedVarargsPrototypes
  655. fatalerr(char *msg, ...)
  656. #else
  657. /*VARARGS*/
  658. fatalerr(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  659.     char *msg;
  660. #endif
  661. {
  662. #if NeedVarargsPrototypes
  663.     va_list args;
  664. #endif
  665.     fprintf(stderr, "%s: error:  ", ProgramName);
  666. #if NeedVarargsPrototypes
  667.     va_start(args, msg);
  668.     vfprintf(stderr, msg, args);
  669.     va_end(args);
  670. #else
  671.     fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  672. #endif
  673.     exit (1);
  674. }
  675.  
  676. #if NeedVarargsPrototypes
  677. warning(char *msg, ...)
  678. #else
  679. /*VARARGS0*/
  680. warning(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  681.     char *msg;
  682. #endif
  683. {
  684. #if NeedVarargsPrototypes
  685.     va_list args;
  686. #endif
  687.     fprintf(stderr, "%s: warning:  ", ProgramName);
  688. #if NeedVarargsPrototypes
  689.     va_start(args, msg);
  690.     vfprintf(stderr, msg, args);
  691.     va_end(args);
  692. #else
  693.     fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  694. #endif
  695. }
  696.  
  697. #if NeedVarargsPrototypes
  698. warning1(char *msg, ...)
  699. #else
  700. /*VARARGS0*/
  701. warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  702.     char *msg;
  703. #endif
  704. {
  705. #if NeedVarargsPrototypes
  706.     va_list args;
  707.     va_start(args, msg);
  708.     vfprintf(stderr, msg, args);
  709.     va_end(args);
  710. #else
  711.     fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);
  712. #endif
  713. }
  714.